import {
  postHistoryApi,
  getHistoryApi,
  getMsbdByHistoryApi,
  deleteAllHistoryApi
} from '../../api/setting'

export default {
  namespaced: true,
  state: {
    historyData: [],
    hd:[]
  },
  mutations: {
    SET_HISTORY(state, historyData) {
      state.historyData = historyData
    },
    SET_HISTORY_DATA(state,data){
      state.hd=data
    }
  },
  actions: {
    async postHistory({
      commit
    }, data) {
      await postHistoryApi({
        bdid: data.bdid
      })
    },
    async getHistory({
      commit
    }) {
      let r = await getHistoryApi()
      commit('SET_HISTORY', r.data.data)
      // console.log(r.data.data)
    },
    async getMsbdByHistory({commit}){
      let r=await getMsbdByHistoryApi()
      commit('SET_HISTORY_DATA',r.data.data)
      // console.log(r.data.data)
    },
    async deleteAllHistory({commit}){
      await deleteAllHistoryApi()
    }
  },
  getters: {

  }
}